import 'package:get/get.dart';
import 'package:getx_simple_code/common/apis/DishesAPI.dart';
import 'package:getx_simple_code/pages/diovc/pojo/dishesEntity.dart';
import 'package:getx_simple_code/pages/diovc/pojo/dishesParam.dart';

import 'state.dart';

class DiovcLogic extends GetxController {
  final DiovcState state = DiovcState();


  @override
  void onReady() {
    // TODO: implement onReady
    print('菜单页面onReady');
    super.onReady();
  }

  @override
  void onInit() {
    // TODO: implement onInit
    getPageList();
    print('菜单页面init');
    super.onInit();
  }
  
  @override
  void onClose() {
    // TODO: implement onClose
    super.onClose();
    print('菜单页面onClose');
  }

  getPageList() async {
    print('刷新数据');
    DishesParam params = DishesParam(page: 1,pageSize: 9999);
    state.entity = await DishesAPIPage.dishesPageList(param: params);
    update();
  }

  jumpdetail(Records item) async{
    await Get.toNamed("/diovc/diovcdetail",
        arguments: item.toJson());
    getPageList();
  }

}
